
$(function(){
	index.nav();
});

var index = {
	nav:function(arr){
		var $this= $(arr);
		var navTitle = $this.attr("data-name");
		var firstNav = $this.attr("data-first");
		if(navTitle){
			$("." + navTitle).removeClass("hidden").addClass("active").siblings("div").addClass("hidden").removeClass("active");
			$("." + navTitle).removeClass("hidden").addClass("active").siblings("span").addClass("hidden").removeClass("active");
		}
		if(firstNav){
			$("." + firstNav).addClass("active").siblings("li").removeClass("active");
			$("." + firstNav).removeClass("hidden").siblings("div").addClass("hidden");
			$("." + firstNav).removeClass("hidden").siblings("span").addClass("hidden");
		}
		$this.parent("li").addClass("active").siblings("li").removeClass("active");
		if("contact" == navTitle){
			var mp = new BMap.Map("contact-map");
		    mp.centerAndZoom(new BMap.Point(104.06,30.67), 12);
		    mp.enableScrollWheelZoom();
		    var point = new BMap.Point(104.06,30.67);
		    var marker = new BMap.Marker(point);  // 创建标注
		    mp.addOverlay(marker);
		    marker.addEventListener("click",getAttr);
		    function getAttr(){
		    	var p = marker.getPosition();       //获取marker的位置
		    	alert("marker的位置是" + p.lng + "," + p.lat);   
		    }
		}
	},
	contact:function(){
		
	}
};